import Mock from "mockjs";
import mockFetch from 'mockjs-fetch';

mockFetch(Mock);
//设置200-2000毫秒延时请求数据
Mock.setup({
  timeout: "200-2000"
});

//Mock.Random.float(1000, 10000, 0, 2)
Mock.mock(/\/api\/goods\/recommend\/list*/,'GET', {
    code: 0,
    msg: 'success',
    'data|20': [{
        'goods_id|+1': 1,
        "goods_name": "@title(1)",
        "goods_cover": "@Image('200x200','@color','水果')",
        "goods_price|30-500.0-2": 30,
        "goods_attr": `${Mock.Random.float(1, 10, 0, 0)},priceg`
    }]
});
 
Mock.mock(/\/api\/categorie\/list*/,'GET', {
    code: 0,
    msg: 'success',
    'data|20': [{
        'cid|+1': 1,
        "categories_name": "@title(1)",
        "categories_img": "@Image('200x200','@color','水果')"
    }]
});

Mock.mock(/\/api\/store\/list*/,'GET', {
    code: 0,
    msg: 'success',
    'data|1-5': [{
        'store_id|+1': 1,
        "store_name": "@title(1)",
        "store_desc": "Arkaden",
        "store_distance": `@float(1, 100, 0, 2) MI`,
        "store_price": '@float(1, 100, 0, 2)'
    }]
});

Mock.mock(/\/api\/address\/list*/,'GET', {
    code: 0,
    msg: 'success',
    'data|1-5': [{
        'address_id|+1': 1,
        "address_name": "@title(1)",
        "address_desc": "@title(2)",
    }]
});

Mock.mock(/\/api\/order\/confirm*/,'POST', {
    code: 0,
    msg: 'success',
    data: 'success'
});

Mock.mock(/\/api\/goods\/info*/,'GET', {
    code: 0,
    msg: 'success',
    data: {
        'goods_id|+1': 1,
        "goods_name": "@title(1)",
        "goods_cover": "@Image('200x200','@color','水果')",
        "goods_price|30-500.0-2": 30,
        "goods_attr": `${Mock.Random.float(1, 10, 0, 0)},priceg`,
        "goods_imgs|2-5": ["@Image('200x200','#ffffff','水果')"],
        "goods_desc": "@paragraph(3)",
    }
});


Mock.mock(/\/api\/payment\/list*/,'GET', {
    code: 0,
    msg: 'success',
    'data|1-3': [{
        'payment_id|+1': 1,
        "payment_name": "@title(2)",
        "payment_img": "@Image('50x50','@color','支')",
    }]
});

